package fr.ginvest.implementation;

import fr.ginvest.entity.Angel;
import fr.ginvest.interfaces.AngelFacadeRemote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class AngelFacade implements AngelFacadeRemote {
	
	@PersistenceContext
	protected EntityManager entityMgr;
	public AngelFacade() {
	}	

	public AngelFacade(EntityManager entityMgr) {
		this.entityMgr = entityMgr;
	}
	
    public Angel updateAngel(Angel a) {
    	return entityMgr.merge(a);
    }
    
    public Angel addAngel(Angel a) {
    	entityMgr.persist(a);
		return a;
    }
    
    public void deleteAngel(Angel a) {
    	entityMgr.remove(a);
    }
    
    public Angel findAngelById(int id) {
    	return entityMgr.find(Angel.class, id);
    }

}
